﻿using System.Data.Entity.ModelConfiguration;
using ZY.EntityFrameWork.Core.Model.Entity;

namespace ZY.EntityFrameWork.Core.Mapping.SQLServer
{
    public class ArchiveInfoMap : EntityTypeConfiguration<ArchiveInfo>
    {
        public ArchiveInfoMap()
        {
            // 定义实体对象映射的数据表和主键
            ToTable("ArchiveInfo").HasKey(q => q.Id);
            // 表字段属性--ArvID设置为必须
            Property(m => m.ArvID).IsRequired(); 
            // HasOptional(e => e.arvLocation)
            //    .WithRequired(e => e.ArchiveInfo)
            //    .WillCascadeOnDelete(true);       // 默认就是级联删除
        }
    }
}
